﻿/// <reference path="/Scripts/jquery-vsdoc.js"/>

function grabAlbumsFromPicasa() {
    /// <summary>Load albums from picasa</summary>
    var settings = {
        username: 'mitasoft1',
        maxResults: 8,
        mode: 'albums',
        showSlideshowLink: false,
        showAlbumDescription: true,
        onclickThumb: function (e) {
            var pictureUrl = e.data.content.src;
            showShareMappingDialog(pictureUrl);
        }
    };

    $("#albums_container").pwi(settings);
}


function showShareMappingDialog(pictureUrl) {
    /// <summary>Show mapping dialog</summary>
    $("#dialog:ui-dialog").dialog("destroy");
    $("#dialog-map").dialog({
        width: 800,
        heigth: 600,
        modal: true,
        buttons: {
            Ok: function () {
                var title = $('#title').val();
                var description = $('#summary').val();

                $.ajax({
                    type: "POST",
                    url: publishPictureUrl,
                    data: 'pictureUrl=' + pictureUrl
                            + '&t=' + title
                            + '&d=' + description,
                    success: function (msg) {
                        alert("Data Saved: " + msg);
                    }
                });
            }
        },
        open: function (event, ui) {
            $('#picture-info').html(pictureUrl);
        }
    });
}